<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../../css/resume/resume_upload.css">
    <link rel="stylesheet" href="../../plugins/layui/css/layui.css">
    <style>
     
    </style>
</head>
<body>
    
    <hr>
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
        <legend>简历上传</legend>
      </fieldset> 
       
      <div class="layui-upload-drag" id="test10">
        <i class="layui-icon"></i>
        <p class="upload">点击上传，或将文件拖拽到此处</p>
        <p class="suggest">简历建议使用 PDF 文件，也支持DOC、DOCX、JPG、PNG 格式</p>
        <span>文件大小不超过8M</span>
          
        <div class="layui-hide" id="uploadDemoView">
          <hr>
          <img src="" alt="上传成功后渲染" style="max-width: 196px">
        </div>
      </div>

    <script src="../../plugins/layui/layui.js"></script>

    <script>
        function add(){       
            layer.load(0)
        }


        layui.use(['upload', 'element', 'layer'], function(){
            var $ = layui.jquery
            ,upload = layui.upload
            ,element = layui.element
            ,layer = layui.layer;

             //拖拽上传
            upload.render({
                elem: '#test10'
                ,url: 'https://httpbin.org/post' //此处用的是第三方的 http 请求演示，实际使用时改成您自己的上传接口即可。
                ,done: function(res){
                layer.msg('上传成功');
                layui.$('#uploadDemoView').removeClass('layui-hide').find('img').attr('src', res.files.file);
                console.log(res)
                }
            });
        });
        </script>
</body>
</html>